package com.github.postsanf.yinian.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.facebook.drawee.view.SimpleDraweeView;
import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.activity.BrowseActivity;
import com.github.postsanf.yinian.activity.MicPlayActivity;
import com.github.postsanf.yinian.activity.TimeKeyWordActivity;
import com.github.postsanf.yinian.activity.TimelineImgDetailActivity;
import com.github.postsanf.yinian.activity.TransferEventActivity;
import com.github.postsanf.yinian.activity.UserStatusActivity;
import com.github.postsanf.yinian.activity.pop.PopMenuTimeLine;
import com.github.postsanf.yinian.bean.YNComment;
import com.github.postsanf.yinian.bean.YNLike;
import com.github.postsanf.yinian.bean.YNPicList;
import com.github.postsanf.yinian.bean.YNStatus;
import com.github.postsanf.yinian.constants.ACTIONs;
import com.github.postsanf.yinian.constants.CommonConstants;
import com.github.postsanf.yinian.constants.YNSingleton;
import com.github.postsanf.yinian.entity.YNCommonResponse;
import com.github.postsanf.yinian.fragment.MineFragement;
import com.github.postsanf.yinian.utils.DisplayUtils;
import com.github.postsanf.yinian.utils.ImageOptHelper;
import com.github.postsanf.yinian.utils.ReqUtils;
import com.github.postsanf.yinian.utils.StringUtils;
import com.github.postsanf.yinian.utils.UIHelper;
import com.github.postsanf.yinian.utils.YNUrlHelper;
import com.github.postsanf.yinian.view.NoScrollGridView;
import com.github.postsanf.yinian.view.NoScrollListview;
import com.google.gson.Gson;
import com.litesuits.http.HttpConfig;
import com.litesuits.http.LiteHttp;
import com.litesuits.http.exception.HttpException;
import com.litesuits.http.listener.HttpListener;
import com.litesuits.http.request.StringRequest;
import com.litesuits.http.request.param.HttpMethods;
import com.litesuits.http.response.Response;

import org.json.JSONObject;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;

import sweetcamera.CameraActivity;

public class TimeLineStatusFristAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private Context context;
    private List<YNStatus> mDatas;
    private static final int EMPTY_VIEW = 10;
    private HashMap<Integer, String> datemap;
    private int userid;
    private boolean isFromTimeline;
    private LayoutInflater inflater;

    public TimeLineStatusFristAdapter(Context context, List<YNStatus> mDatas, int userid, boolean isFromTimeline) {
        this.context = context;
        this.mDatas = mDatas;
        this.userid = userid;
        this.isFromTimeline = isFromTimeline;
        this.inflater = LayoutInflater.from(context);
        datemap = new HashMap<>();
    }

    public void update(List<YNStatus> mDatas) {
        this.mDatas = mDatas;
    }

    public class EmptyViewHolder extends RecyclerView.ViewHolder {
        public EmptyViewHolder(View itemView) {
            super(itemView);
        }
    }

    private class ViewHolder extends RecyclerView.ViewHolder {
        TextView view_time_mouth;
        TextView view_time_year;
        SimpleDraweeView item_avatar;
        TextView card_item_name;
        TextView card_item_time;

        ImageView timeline_type;
        LinearLayout item_menu;
        ImageView item_menu_face;
        TextView item_menu_facenum;
        LinearLayout item_menu_pailide;
        ImageView item_pailide_del;
        ImageView item_pailide_share;
        //元素为主
        LinearLayout main_img;
        TextView main_text_econtent;
        LinearLayout main_mic;
        TextView main_mic_etext;
        TextView main_mic_etext_tip;
        RelativeLayout main_mic_mic;
        TextView main_location_etext;
        SimpleDraweeView main_location_pic;
        //元素为辅
        LinearLayout ll_status;
        ImageView iv_jianjiao;
        RelativeLayout zan_recycler_frist;
        RecyclerView zan_recycler_horizontal;
        View zan_recycler_horizontal_line;
        NoScrollGridView mGridView;
        SimpleDraweeView item_singepic;
        SimpleDraweeView item_doublepic1;
        SimpleDraweeView item_doublepic2;

        SimpleDraweeView main_pailide_pic;

        LinearLayout timeline_hix;
        View timeline_hix_line;
        TextView item_etext;
        RelativeLayout item_mic;
        TextView item_etext_tip;
        TextView item_econtent;
        View item_econtent_line;
        NoScrollGridView item_piclist_gridview;
        View item_piclist_gridview_line;
        ImageView pailide_pic1;
        ImageView pailide_pic2;
        NoScrollListview card_lv_comments;
        LinearLayout ll_timeline_commentsmore;
        TextView ll_timeline_commentsmore_num;
        SimpleDraweeView ll_timeline_commentsmore1_avatar;
        SimpleDraweeView ll_timeline_commentsmore2_avatar;
        SimpleDraweeView ll_timeline_commentsmore3_avatar;
        TextView ll_timeline_commentsmore1_content;
        TextView ll_timeline_commentsmore2_content;
        TextView ll_timeline_commentsmore3_content;
        View status_btom;
        TextView readnum;
        ImageView sharegetzan;


        public ViewHolder(View itemView) {
            super(itemView);
            timeline_type = (ImageView) itemView.findViewById(R.id.timeline_type);
            item_avatar = (SimpleDraweeView) itemView.findViewById(R.id.card_item_avatar);
            card_item_name = (TextView) itemView.findViewById(R.id.card_item_name);
            card_item_time = (TextView) itemView.findViewById(R.id.card_item_time);
            item_menu = (LinearLayout) itemView.findViewById(R.id.item_menu);
            readnum = (TextView) itemView.findViewById(R.id.readnum);
            item_menu_face = (ImageView) itemView.findViewById(R.id.item_menu_face);
            item_menu_facenum = (TextView) itemView.findViewById(R.id.item_menu_facenum);
            item_menu_pailide = (LinearLayout) itemView.findViewById(R.id.item_menu_pailide);
            item_pailide_del = (ImageView) itemView.findViewById(R.id.item_pailide_del);
            item_pailide_share = (ImageView) itemView.findViewById(R.id.item_pailide_share);
            ll_status = (LinearLayout) itemView.findViewById(R.id.ll_status);
            main_img = (LinearLayout) itemView.findViewById(R.id.main_img);
            item_singepic = (SimpleDraweeView) itemView.findViewById(R.id.item_singepic);
            item_doublepic1 = (SimpleDraweeView) itemView.findViewById(R.id.item_doublepic1);
            item_doublepic2 = (SimpleDraweeView) itemView.findViewById(R.id.item_doublepic2);
            mGridView = (NoScrollGridView) itemView.findViewById(R.id.item_gridview);
            main_text_econtent = (TextView) itemView.findViewById(R.id.main_text_econtent);
            main_mic = (LinearLayout) itemView.findViewById(R.id.main_mic);
            main_mic_etext = (TextView) itemView.findViewById(R.id.main_mic_etext);
            main_mic_etext_tip = (TextView) itemView.findViewById(R.id.main_mic_etext_tip);
            main_mic_mic = (RelativeLayout) itemView.findViewById(R.id.main_mic_mic);
            main_location_etext = (TextView) itemView.findViewById(R.id.main_location_etext);
            main_location_pic = (SimpleDraweeView) itemView.findViewById(R.id.main_location_pic);
            main_pailide_pic = (SimpleDraweeView) itemView.findViewById(R.id.main_pailide_pic);
            iv_jianjiao = (ImageView) itemView.findViewById(R.id.iv_jianjiao);
            zan_recycler_frist = (RelativeLayout) itemView.findViewById(R.id.zan_recycler_frist);
            zan_recycler_horizontal = (RecyclerView) itemView.findViewById(R.id.zan_recycler_horizontal);
            sharegetzan = (ImageView) itemView.findViewById(R.id.sharegetzan);
            zan_recycler_horizontal_line = (View) itemView.findViewById(R.id.zan_recycler_horizontal);
            timeline_hix = (LinearLayout) itemView.findViewById(R.id.timeline_hix);
            timeline_hix_line = (View) itemView.findViewById(R.id.timeline_hix_line);
            item_etext = (TextView) itemView.findViewById(R.id.item_etext);
            item_piclist_gridview = (NoScrollGridView) itemView.findViewById(R.id.item_piclist_gridview);
            item_piclist_gridview_line = (View) itemView.findViewById(R.id.item_piclist_gridview_line);
            pailide_pic1 = (ImageView) itemView.findViewById(R.id.pailide_pic1);
            pailide_pic2 = (ImageView) itemView.findViewById(R.id.pailide_pic2);
            item_mic = (RelativeLayout) itemView.findViewById(R.id.item_mic);
            item_etext_tip = (TextView) itemView.findViewById(R.id.item_etext_tip);
            item_econtent = (TextView) itemView.findViewById(R.id.item_econtent);
            item_econtent_line = (View) itemView.findViewById(R.id.item_econtent_line);
            card_lv_comments = (NoScrollListview) itemView.findViewById(R.id.card_lv_comments);
            ll_timeline_commentsmore = (LinearLayout) itemView.findViewById(R.id.ll_timeline_commentsmore);
            ll_timeline_commentsmore_num = (TextView) itemView.findViewById(R.id.ll_timeline_commentsmore_num);
            ll_timeline_commentsmore1_avatar = (SimpleDraweeView) itemView.findViewById(R.id.ll_timeline_commentsmore1_avatar);
            ll_timeline_commentsmore2_avatar = (SimpleDraweeView) itemView.findViewById(R.id.ll_timeline_commentsmore2_avatar);
            ll_timeline_commentsmore3_avatar = (SimpleDraweeView) itemView.findViewById(R.id.ll_timeline_commentsmore3_avatar);
            ll_timeline_commentsmore1_content = (TextView) itemView.findViewById(R.id.ll_timeline_commentsmore1_content);
            ll_timeline_commentsmore2_content = (TextView) itemView.findViewById(R.id.ll_timeline_commentsmore2_content);
            ll_timeline_commentsmore3_content = (TextView) itemView.findViewById(R.id.ll_timeline_commentsmore3_content);
            view_time_mouth = (TextView) itemView.findViewById(R.id.view_time_mouth);
            view_time_year = (TextView) itemView.findViewById(R.id.view_time_year);
            status_btom = (View) itemView.findViewById(R.id.status_btom);
        }

        public void initItemPic(final YNStatus item) {
            if (item.getPicList() != null && item.getPicList().size() > 0) {
                item_piclist_gridview.setVisibility(View.VISIBLE);
                item_piclist_gridview_line.setVisibility(View.VISIBLE);
                LinearLayout.LayoutParams lps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UIHelper.getTmForeGdHigh(context));
                lps.setMargins(UIHelper.dip2px(context, 10), UIHelper.dip2px(context, 10),
                        UIHelper.dip2px(context, 10), UIHelper.dip2px(context, 10));
                item_piclist_gridview.setLayoutParams(lps);
                item_piclist_gridview.setOnTouchInvalidPositionListener(new NoScrollGridView.OnTouchInvalidPositionListener() {
                    @Override
                    public boolean onTouchInvalidPosition(int motionEvent) {
                        YNSingleton.getInstance().setCurStatus(item);
                        context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                        return false;
                    }
                });
                item_piclist_gridview.setAdapter(new TimeLineGridViewAdapter2(context, item.getPicList(), item.getPicList().size()));
                item_piclist_gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
                        YNSingleton.getInstance().setCurStatus(item);
                        if (item.getPicList().size() > 4 && position == 3) {
                            context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                        } else {
                            Intent intent = new Intent(context, BrowseActivity.class);
                            intent.putExtra(CommonConstants.YNPOSITION, position);
                            intent.putExtra(CommonConstants.TIMELINE, true);
                            context.startActivity(intent);
                        }
                    }
                });
            } else {
                item_piclist_gridview.setVisibility(View.GONE);
                item_piclist_gridview_line.setVisibility(View.GONE);
            }
        }

        public void initItemEcontent(YNStatus item) {
            if (!StringUtils.isEmpty(item.getEtext())) {
                item_econtent.setVisibility(View.VISIBLE);
                item_econtent_line.setVisibility(View.VISIBLE);
                item_econtent.setText(item.getEtext());
            } else {
                item_econtent.setVisibility(View.GONE);
                item_econtent_line.setVisibility(View.GONE);
            }
        }

        public void initItemAvatarTime(final YNStatus item, int position) {
            String dateStr = item.getEuploadtime();
            try {
                Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).parse(dateStr);
                String InMouth = DateFormat.format("MM", date).toString();
                String Indd = DateFormat.format("dd", date).toString();
                String dateItem = InMouth + "-" + Indd;
                String dateItem2 = DateFormat.format("yyyy", date).toString() + "." + InMouth;
                datemap.put(position, dateItem);
                if (position == 0) {
                    view_time_mouth.setText(Indd);
                    view_time_year.setText(dateItem2);
                    view_time_year.setVisibility(View.VISIBLE);
                    view_time_mouth.setVisibility(View.VISIBLE);
                } else {
                    if (TextUtils.equals(dateItem, datemap.get(position - 1))) {
                        view_time_year.setVisibility(View.INVISIBLE);
                        view_time_mouth.setVisibility(View.INVISIBLE);
                    } else {
                        view_time_year.setVisibility(View.VISIBLE);
                        view_time_mouth.setVisibility(View.VISIBLE);
                        view_time_mouth.setText(Indd);
                        view_time_year.setText(dateItem2);
                    }
                }
            } catch (ParseException e) {
                e.printStackTrace();
            }
            String hms = dateStr.split(" ")[1];
            card_item_time.setText(String.valueOf(hms.split(":")[0] + ":" + hms.split(":")[1]));
            //头像昵称
            ImageOptHelper.showFrescoAvatar(Uri.parse(YNUrlHelper.getAvatarUrl(context, item.getPublishUser().getUpic())), item_avatar, context);
            card_item_name.setText(item.getPublishUser().getUnickname());
            if (isFromTimeline) {
                item_avatar.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, UserStatusActivity.class);
                        intent.putExtra(CommonConstants.YNUSERID, item.getPublishUser().getUserid());
                        intent.putExtra(CommonConstants.YNGROUPID, item.getEgroupid());
                        context.startActivity(intent);
                    }
                });
            }
        }

        public void initItemReadNum(final YNStatus item) {
            if (item.geteView() > 0) {
                readnum.setVisibility(View.VISIBLE);
                if (item.geteView() >= 10000) {
                    DecimalFormat df = new DecimalFormat("#.0");
                    readnum.setText(df.format(item.geteView() / 10000) + "万阅读");
                } else {
                    readnum.setText(String.valueOf(item.geteView()) + "阅读");
                }
            } else {
                readnum.setVisibility(View.GONE);
            }
        }


        public void initItemZanComment(final YNStatus item) {
            zan_recycler_frist.setVisibility(View.VISIBLE);
            ll_status.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    YNSingleton.getInstance().setCurStatus(item);
                    context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                }
            });
            item_menu.setVisibility(View.VISIBLE);
            item_menu.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    popAwindow(v.findViewById(R.id.item_menu_face), item);
                }
            });
            //赞
            List<YNLike> likeList = item.getLike();
            if (likeList != null && likeList.size() > 0) {
                item_menu_facenum.setText(String.valueOf(likeList.size()));
                if (UIHelper.juideIsContionMe(likeList, userid)) {
                    for (int i = 0; i < likeList.size(); i++) {
                        if (likeList.get(i).getLikeUserID() == userid) {
                            UIHelper.setFace(likeList.get(i).getLikeStatus(), item_menu_face);
                            break;
                        }
                    }
                } else {
                    item_menu_face.setImageResource(R.drawable.timeline_zan_before);
                }
                item_menu_facenum.setVisibility(View.VISIBLE);
                zan_recycler_horizontal.setVisibility(View.VISIBLE);
                zan_recycler_horizontal_line.setVisibility(View.VISIBLE);
                zan_recycler_horizontal.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
                zan_recycler_horizontal.setAdapter(new ZanHistoryAdapter(context, item));
            } else {
                item_menu_face.setImageResource(R.drawable.timeline_zan_before);
                zan_recycler_horizontal.setVisibility(View.GONE);
                zan_recycler_horizontal_line.setVisibility(View.GONE);
                item_menu_facenum.setVisibility(View.GONE);
            }
            sharegetzan.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    context.sendBroadcast(new Intent("doClickFristShare").putExtra("ynStatus", item));
                }
            });
            //评论
            List<YNComment> commentList = item.getComments();
            if (commentList != null && commentList.size() > 0) {
                if (item.getComments().size() > 4) {
                    card_lv_comments.setVisibility(View.GONE);
                    ll_timeline_commentsmore.setVisibility(View.VISIBLE);
                    ll_timeline_commentsmore_num.setText(item.getComments().size() + "评论");
                    ImageOptHelper.showFrescoAvatar(Uri.parse(
                            YNUrlHelper.getAvatarUrl(context, commentList.get(0).getCommentUser().getUpic())), ll_timeline_commentsmore1_avatar, context);
                    ImageOptHelper.showFrescoAvatar(Uri.parse(
                            YNUrlHelper.getAvatarUrl(context, commentList.get(commentList.size() - 2).getCommentUser().getUpic())), ll_timeline_commentsmore2_avatar, context);
                    ImageOptHelper.showFrescoAvatar(Uri.parse(
                            YNUrlHelper.getAvatarUrl(context, commentList.get(commentList.size() - 1).getCommentUser().getUpic())), ll_timeline_commentsmore3_avatar, context);
                    ll_timeline_commentsmore1_content.setText(UIHelper.getCommentContent(context, commentList.get(0).getCommentUser().getUnickname(), commentList.get(0).getCcontent()));
                    ll_timeline_commentsmore2_content.setText(UIHelper.getCommentContent(context, commentList.get(commentList.size() - 2).getCommentUser().getUnickname(), commentList.get(commentList.size() - 2).getCcontent()));
                    ll_timeline_commentsmore3_content.setText(UIHelper.getCommentContent(context, commentList.get(commentList.size() - 1).getCommentUser().getUnickname(), commentList.get(commentList.size() - 1).getCcontent()));
                } else {
                    ll_timeline_commentsmore.setVisibility(View.GONE);
                    card_lv_comments.setVisibility(View.VISIBLE);
                    card_lv_comments.setAdapter(new TimeLineCommentAdapter(context, item.getComments()));
                    card_lv_comments.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                            YNSingleton.getInstance().setCurStatus(item);
                            context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                        }
                    });
                }
            } else {
                card_lv_comments.setVisibility(View.GONE);
                ll_timeline_commentsmore.setVisibility(View.GONE);
            }
        }

        public void initItemMic(final YNStatus item) {
            item_mic.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(context, MicPlayActivity.class);
                    intent.putExtra("Eaudio", item.getEaudio());
                    intent.putExtra("ePeopleName", item.getePeopleName());
                    intent.putExtra("Eplace", item.getEplace());
                    context.startActivity(intent);
                }
            });
            if (item.geteMain() != 3) {
                //语音
                if (!StringUtils.isEmpty(item.getEaudio())) {
                    item_mic.setVisibility(View.VISIBLE);
                } else {
                    item_mic.setVisibility(View.GONE);
                }
                //和谁，地点
                if (!StringUtils.isEmpty(item.getePeopleName())) {
                    timeline_hix.setVisibility(View.VISIBLE);
                    timeline_hix_line.setVisibility(View.VISIBLE);
                    item_etext_tip.setVisibility(View.GONE);
                    if (!StringUtils.isEmpty(item.getEplace())) {
                        if (!StringUtils.isEmpty(item.getEaudio())) {
                            item_etext.setText(UIHelper.getTextHtmlMic1(context, item.getePeopleName(), item.getEplace()));
                        } else {
                            item_etext.setText(UIHelper.getTextHtmlfuMic1(context, item.getePeopleName(), item.getEplace()));
                        }
                    } else {
                        if (!StringUtils.isEmpty(item.getEaudio())) {
                            item_etext.setText(UIHelper.getTextHtmlfuMic2(context, item.getePeopleName()));
                        } else {
                            item_etext.setText(UIHelper.getTextHtmlfuMic3(context, item.getePeopleName()));
                        }
                    }
                } else {
                    timeline_hix.setVisibility(View.VISIBLE);
                    timeline_hix_line.setVisibility(View.VISIBLE);
                    if (!StringUtils.isEmpty(item.getEplace())) {
                        timeline_hix.setVisibility(View.VISIBLE);
                        timeline_hix_line.setVisibility(View.VISIBLE);
                        if (!StringUtils.isEmpty(item.getEaudio())) {
                            item_etext.setText(UIHelper.getTextHtmlMic3(context, item.getEplace()));
                        } else {
                            item_etext.setText(UIHelper.getTextHtmlLocation2(context, item.getEplace()));
                        }
                    } else {
                        timeline_hix.setVisibility(View.VISIBLE);
                        timeline_hix_line.setVisibility(View.VISIBLE);
                        if (!StringUtils.isEmpty(item.getEaudio())) {
                            item_etext_tip.setVisibility(View.VISIBLE);
                        } else {
                            timeline_hix.setVisibility(View.GONE);
                            timeline_hix_line.setVisibility(View.GONE);
                            item_etext_tip.setVisibility(View.GONE);
                        }
                    }
                }
            } else {
                item_etext_tip.setVisibility(View.GONE);
                timeline_hix_line.setVisibility(View.GONE);
                timeline_hix.setVisibility(View.GONE);
            }
        }

        public void bindData(final YNStatus item, final int position) {
            if (item != null) {
                final List<YNPicList> Ynpiclists = item.getPicList();
                switch (item.geteMain()) {
                    case 0:
                        //图片为主的图片
                        timeline_type.setImageResource(R.drawable.timeline_type_img);
                        main_img.setVisibility(View.VISIBLE);
                        main_text_econtent.setVisibility(View.GONE);
                        main_mic.setVisibility(View.GONE);
                        main_location_etext.setVisibility(View.GONE);
                        main_location_pic.setVisibility(View.GONE);
                        main_pailide_pic.setVisibility(View.GONE);
                        pailide_pic1.setVisibility(View.GONE);
                        pailide_pic2.setVisibility(View.GONE);
                        item_menu.setVisibility(View.VISIBLE);
                        item_menu_pailide.setVisibility(View.GONE);
                        if (Ynpiclists != null && Ynpiclists.size() > 0) {
                            if (Ynpiclists.size() == 1) {
                                mGridView.setVisibility(View.GONE);
                                item_doublepic1.setVisibility(View.GONE);
                                item_doublepic2.setVisibility(View.GONE);
                                item_singepic.setVisibility(View.VISIBLE);
                                item_singepic.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UIHelper.getTmSingeHigh(context)));
                                ImageOptHelper.showFrescoStatus(Ynpiclists.get(0).getThumbnail(), item_singepic, context);
                                item_singepic.setOnClickListener(new picOnClickListener(item, 0));
                            } else if (Ynpiclists.size() == 2) {
                                mGridView.setVisibility(View.GONE);
                                item_singepic.setVisibility(View.GONE);
                                item_doublepic1.setVisibility(View.VISIBLE);
                                item_doublepic2.setVisibility(View.VISIBLE);
                                LinearLayout.LayoutParams rlp = new LinearLayout.LayoutParams(UIHelper.getTmDoubleHigh(context), UIHelper.getTmDoubleHigh(context));
//                                rlp.setMargins(0, 0, UIHelper.dip2px(context, 2), 0);
                                item_doublepic1.setLayoutParams(rlp);
                                item_doublepic2.setLayoutParams(rlp);
                                ImageOptHelper.showFrescoStatus(Ynpiclists.get(0).getThumbnail(), item_doublepic1, context);
                                ImageOptHelper.showFrescoStatus(Ynpiclists.get(1).getThumbnail(), item_doublepic2, context);
                                item_doublepic1.setOnClickListener(new picOnClickListener(item, 0));
                                item_doublepic2.setOnClickListener(new picOnClickListener(item, 1));
                            } else {
                                item_singepic.setVisibility(View.GONE);
                                item_doublepic1.setVisibility(View.GONE);
                                item_doublepic2.setVisibility(View.GONE);
                                mGridView.setVisibility(View.VISIBLE);
                                if (Ynpiclists.size() == 3)
                                    mGridView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UIHelper.getTmThreeGdHigh(context)));
                                else
                                    mGridView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UIHelper.getTmMoreGdHigh(context)));
                                mGridView.setAdapter(new TimeLineGridViewFristAdapter(context, Ynpiclists, Ynpiclists.size()));
                                mGridView.setOnTouchInvalidPositionListener(new NoScrollGridView.OnTouchInvalidPositionListener() {
                                    @Override
                                    public boolean onTouchInvalidPosition(int motionEvent) {
                                        YNSingleton.getInstance().setCurStatus(item);
                                        context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                                        return false;
                                    }
                                });
                                mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                                    @Override
                                    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
                                        YNSingleton.getInstance().setCurStatus(item);
                                        if (position == 5) {
                                            context.startActivity(new Intent(context, TimelineImgDetailActivity.class).putExtra("fromfrist", true));
                                        } else {
                                            Intent intent = new Intent(context, BrowseActivity.class);
                                            intent.putExtra(CommonConstants.YNPOSITION, position);
                                            intent.putExtra(CommonConstants.TIMELINE, true);
                                            context.startActivity(intent);
                                        }
                                    }
                                });
                            }
                        }
                        if (StringUtils.isEmpty(item.getEtext()) && StringUtils.isEmpty(item.getEaudio()) && StringUtils.isEmpty(item.getePeopleName())
                                && StringUtils.isEmpty(item.getEplace()) && (item.getComments() == null || item.getComments().size() == 0)
                                && (item.getLike() == null || item.getLike().size() == 0)) {
                            iv_jianjiao.setVisibility(View.GONE);
                        } else {
                            iv_jianjiao.setVisibility(View.VISIBLE);
                        }
                        item_piclist_gridview.setVisibility(View.GONE);
                        item_piclist_gridview_line.setVisibility(View.GONE);
                        initItemEcontent(item);
                        initItemMic(item);
                        initItemAvatarTime(item, position);
                        initItemZanComment(item);
                        initItemReadNum(item);
                        break;
                    case 1:
                        timeline_type.setImageResource(R.drawable.timeline_type_text);
                        main_text_econtent.setText(item.getEtext());
                        main_text_econtent.setVisibility(View.VISIBLE);
                        main_img.setVisibility(View.GONE);
                        main_mic.setVisibility(View.GONE);
                        main_location_etext.setVisibility(View.GONE);
                        main_location_pic.setVisibility(View.GONE);
                        main_pailide_pic.setVisibility(View.GONE);
                        pailide_pic1.setVisibility(View.GONE);
                        pailide_pic2.setVisibility(View.GONE);
                        item_menu.setVisibility(View.VISIBLE);
                        item_menu_pailide.setVisibility(View.GONE);
                        item_singepic.setVisibility(View.GONE);
                        if (StringUtils.isEmpty(item.getEaudio()) && StringUtils.isEmpty(item.getEplace()) && StringUtils.isEmpty(item.getePeopleName())
                                && (item.getComments() == null || item.getComments().size() == 0)
                                && (item.getLike() == null || item.getLike().size() == 0)
                                && (item.getPicList() == null || item.getPicList().size() == 0)) {
                            iv_jianjiao.setVisibility(View.GONE);
                        } else {
                            iv_jianjiao.setVisibility(View.VISIBLE);
                        }
                        initItemMic(item);
                        initItemPic(item);
                        item_econtent.setVisibility(View.GONE);
                        item_econtent_line.setVisibility(View.GONE);
                        initItemAvatarTime(item, position);
                        initItemZanComment(item);
                        initItemReadNum(item);
                        break;
                    case 2:
                        timeline_type.setImageResource(R.drawable.timeline_type_mic);
                        main_mic.setVisibility(View.VISIBLE);
                        main_img.setVisibility(View.GONE);
                        main_text_econtent.setVisibility(View.GONE);
                        main_location_etext.setVisibility(View.GONE);
                        main_location_pic.setVisibility(View.GONE);
                        main_pailide_pic.setVisibility(View.GONE);
                        pailide_pic1.setVisibility(View.GONE);
                        pailide_pic2.setVisibility(View.GONE);
                        item_menu.setVisibility(View.VISIBLE);
                        item_menu_pailide.setVisibility(View.GONE);
                        item_singepic.setVisibility(View.GONE);
                        main_mic_mic.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Intent intent = new Intent(context, MicPlayActivity.class);
                                intent.putExtra("Eaudio", item.getEaudio());
                                intent.putExtra("ePeopleName", item.getePeopleName());
                                intent.putExtra("Eplace", item.getEplace());
                                context.startActivity(intent);
                            }
                        });
                        if (!StringUtils.isEmpty(item.getePeopleName())) {
                            main_mic_etext_tip.setVisibility(View.GONE);
                            if (!StringUtils.isEmpty(item.getEplace()))
                                main_mic_etext.setText(UIHelper.getTextHtmlMic1(context, item.getePeopleName(), item.getEplace()));
                            else
                                main_mic_etext.setText(UIHelper.getTextHtmlMic2(context, item.getePeopleName()));
                        } else {
                            if (!StringUtils.isEmpty(item.getEplace()))
                                main_mic_etext.setText(UIHelper.getTextHtmlMic3(context, item.getEplace()));
                            else
                                main_mic_etext_tip.setVisibility(View.VISIBLE);
                        }
                        if (StringUtils.isEmpty(item.getEtext())
                                && (item.getComments() == null || item.getComments().size() == 0)
                                && (item.getLike() == null || item.getLike().size() == 0)
                                && (item.getPicList() == null || item.getPicList().size() == 0)) {
                            iv_jianjiao.setVisibility(View.GONE);
                        } else {
                            iv_jianjiao.setVisibility(View.VISIBLE);
                        }
                        initItemPic(item);
                        initItemEcontent(item);
                        item_mic.setVisibility(View.GONE);
                        timeline_hix.setVisibility(View.GONE);
                        timeline_hix_line.setVisibility(View.GONE);
                        item_etext_tip.setVisibility(View.GONE);
                        initItemAvatarTime(item, position);
                        initItemZanComment(item);
                        initItemReadNum(item);
                        break;
                    case 3:
                        main_location_etext.setVisibility(View.VISIBLE);
                        main_location_pic.setVisibility(View.VISIBLE);
                        main_img.setVisibility(View.GONE);
                        main_text_econtent.setVisibility(View.GONE);
                        main_mic.setVisibility(View.GONE);
                        main_pailide_pic.setVisibility(View.GONE);
                        pailide_pic1.setVisibility(View.GONE);
                        pailide_pic2.setVisibility(View.GONE);
                        item_menu.setVisibility(View.VISIBLE);
                        item_menu_pailide.setVisibility(View.GONE);
                        item_singepic.setVisibility(View.GONE);
                        timeline_type.setImageResource(R.drawable.timeline_type_location);
                        if (!StringUtils.isEmpty(item.getePeopleName())) {
                            main_location_etext.setText(UIHelper.getTextHtmlLocation1(context, item.getePeopleName(), item.getEplace()));
                        } else {
                            main_location_etext.setText(UIHelper.getTextHtmlLocation2(context, item.getEplace()));
                        }
                        ImageOptHelper.showFrescoStatus(StringUtils.repaceImgUrl(YNUrlHelper.getStatusUrl(context, item.getePlacePic())), main_location_pic, context);
                        if (StringUtils.isEmpty(item.getEtext()) && StringUtils.isEmpty(item.getEaudio()) && StringUtils.isEmpty(item.getePeopleName())
                                && (item.getComments() == null || item.getComments().size() == 0)
                                && (item.getLike() == null || item.getLike().size() == 0)
                                && (item.getPicList() == null || item.getPicList().size() == 0)) {
                            iv_jianjiao.setVisibility(View.GONE);
                        } else {
                            iv_jianjiao.setVisibility(View.VISIBLE);
                        }
                        initItemPic(item);
                        initItemEcontent(item);
                        initItemMic(item);
                        initItemAvatarTime(item, position);
                        initItemZanComment(item);
                        initItemReadNum(item);
                        break;
                    case 5:
                        timeline_type.setImageResource(R.drawable.timeline_type_pailide);
                        main_pailide_pic.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, UIHelper.getTmSingeHigh(context)));
                        ImageOptHelper.showFrescoStatus(item.geteVerifyPic(), main_pailide_pic, context);
                        main_pailide_pic.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
//                                YNSingleton.getInstance().setCurStatus(item);
//                                context.startActivity(new Intent(context, PailideShowActivity.class));
                                context.startActivity(new Intent(context, CameraActivity.class).putExtra("IsSaoMiao", true));
                            }
                        });
                        main_location_etext.setVisibility(View.GONE);
                        main_location_pic.setVisibility(View.GONE);
                        main_img.setVisibility(View.GONE);
                        main_text_econtent.setVisibility(View.GONE);
                        main_mic.setVisibility(View.GONE);
                        item_piclist_gridview.setVisibility(View.GONE);
                        item_piclist_gridview_line.setVisibility(View.GONE);
                        item_econtent.setVisibility(View.GONE);
                        item_econtent_line.setVisibility(View.GONE);
                        item_mic.setVisibility(View.GONE);
                        timeline_hix.setVisibility(View.GONE);
                        timeline_hix_line.setVisibility(View.GONE);
                        item_etext_tip.setVisibility(View.GONE);
                        main_pailide_pic.setVisibility(View.VISIBLE);
                        iv_jianjiao.setVisibility(View.VISIBLE);
                        pailide_pic1.setVisibility(View.VISIBLE);
                        pailide_pic2.setVisibility(View.VISIBLE);
                        item_menu.setVisibility(View.GONE);
                        item_menu_pailide.setVisibility(View.VISIBLE);
                        item_singepic.setVisibility(View.GONE);
                        initItemAvatarTime(item, position);
                        if (item.getPublishUser().getUserid() == userid)
                            item_pailide_del.setVisibility(View.VISIBLE);
                        else {
                            item_pailide_del.setVisibility(View.GONE);
                        }
                        item_pailide_del.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                ToDelDialog(item);
                            }
                        });
                        item_pailide_share.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                context.sendBroadcast(new Intent("doPaiLideShare").putExtra("ynStatus", item));
                            }
                        });
                        readnum.setVisibility(View.GONE);
                        zan_recycler_frist.setVisibility(View.GONE);
                        ll_status.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                            }
                        });
                        break;
                }
                if (position == mDatas.size() - 1)
                    status_btom.setVisibility(View.VISIBLE);
                else
                    status_btom.setVisibility(View.GONE);
            }
        }
    }

    // 创建ViewHolder
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == EMPTY_VIEW) {
            return new EmptyViewHolder(inflater.inflate(R.layout.yn_empty_status, parent, false));
        }
        return new ViewHolder(inflater.inflate(R.layout.yn_include_timeline_status_fristitem, parent, false));
    }


    // 绑定数据到View
    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder rv_holder, int position) {
        if (rv_holder instanceof ViewHolder) {
            ViewHolder holder = (ViewHolder) rv_holder;
//            holder.setIsRecyclable(false);
            holder.bindData(mDatas.get(position), position);
        }
    }


    public void ToDelDialog(final YNStatus ynStatus) {
        android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
        builder.setCancelable(false);
        final android.app.AlertDialog dlg = builder.create();
        dlg.show();
        Window window = dlg.getWindow();
        window.setContentView(R.layout.pub_dialog);
        window.setBackgroundDrawableResource(R.color.transparent);
        WindowManager.LayoutParams layout = dlg.getWindow().getAttributes();
        layout.width = DisplayUtils.getScreenWidthPixels((Activity) context) - DisplayUtils.dp2px(context, 35 * 2);
        dlg.getWindow().setAttributes(layout);
        TextView tt = (TextView) window.findViewById(R.id.pp_title);
        tt.setText("提示");
        TextView content = (TextView) window.findViewById(R.id.pp_content);
        content.setText("确定要删除动态详情吗?");
        TextView cancel = (TextView) window
                .findViewById(R.id.btn_cancel);
        cancel.setText("取消");
        cancel.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                dlg.cancel();
            }
        });
        final TextView ok = (TextView) window.findViewById(R.id.btn_ok);
        ok.setText("确定");
        ok.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                dlg.cancel();
                doDeleteStatus(ynStatus);
            }
        });
    }


    private void doDeleteStatus(final YNStatus mCurStatus) {
        LinkedHashMap<String, String> mParam = new LinkedHashMap<>();
        mParam.put(CommonConstants.YNS_EVENT_ID, String.valueOf(mCurStatus.getEid()));
        StringRequest req = new StringRequest(context.getString(R.string.BASE_URL) + context.getString(R.string.ynDeleteEvent))
                .setMethod(HttpMethods.Post)
                .setParamMap(mParam)
                .setHttpListener(new HttpListener<String>(true, false, true) {
                    @Override
                    public void onSuccess(String s, Response<String> response) {
                        YNCommonResponse resDelete = new Gson().fromJson(s, YNCommonResponse.class);
                        if (ReqUtils.isSuccess(resDelete.getCode())) {
                            Intent mIntent = new Intent(ACTIONs.actionStatus);
                            // 同步删除动态
                            mIntent.putExtra(ACTIONs.IsAdd, false);
                            mIntent.putExtra(ACTIONs.StatusId, mCurStatus.getEid());
                            context.sendBroadcast(mIntent);
                        } else {
                            Toast.makeText(context, "删除失败", Toast.LENGTH_SHORT).show();
                        }
                    }

                    @Override
                    public void onFailure(HttpException e, Response<String> response) {
//                        showToast(CommonConstants.YN_NET_LINK);
                    }
                });
        LiteHttp.newApacheHttpClient(new HttpConfig(context))
                .executeAsync(req);
    }


    @Override
    public int getItemViewType(int position) {
        if (mDatas.size() == 0) {
            return EMPTY_VIEW;
        }
        return super.getItemViewType(position);
    }

    @Override
    public int getItemCount() {
        return mDatas.size() > 0 ? mDatas.size() : 1;
    }

    public void addItemsFromTop(List<YNStatus> items) {
        if (items == null || items.size() == 0) {
            this.mDatas.clear();
            this.notifyItemRangeInserted(0, 0);
            this.notifyDataSetChanged();
            return;
        }
        this.mDatas.addAll(0, items);
        this.notifyItemRangeInserted(0, items.size());
        this.notifyDataSetChanged();
    }

    public void addItemsFromTopOne(YNStatus items) {
        if (items == null)
            return;
        this.mDatas.add(0, items);
        this.notifyItemRangeInserted(0, 1);
        this.notifyDataSetChanged();
    }

    public void removeOne(int ids) {
        for (int i = 0; i < mDatas.size(); i++) {
            if (ids == mDatas.get(i).getEid()) {
                this.mDatas.remove(i);
                this.notifyItemRemoved(i);
                break;
            }
        }
    }

    public void SyncComment() {
        for (int i = 0; i < mDatas.size(); i++) {
            if (mDatas.get(i).getEid() == YNSingleton.getInstance().getCurStatus().getEid()) {
                mDatas.get(i).setComments(YNSingleton.getInstance().getCurStatus().getComments());
                TimeLineStatusFristAdapter.this.notifyDataSetChanged();
            }
        }
    }

    public void SyncLike() {
        for (int i = 0; i < mDatas.size(); i++) {
            if (mDatas.get(i).getEid() == YNSingleton.getInstance().getCurStatus().getEid()) {
                mDatas.get(i).setLike(YNSingleton.getInstance().getCurStatus().getLike());
                TimeLineStatusFristAdapter.this.notifyDataSetChanged();
            }
        }
    }

    public void SyncDelSingle() {
        for (int i = 0; i < mDatas.size(); i++) {
            if (mDatas.get(i).getEid() == YNSingleton.getInstance().getCurStatus().getEid()) {
                mDatas.get(i).setPicList(YNSingleton.getInstance().getCurStatus().getPicList());
                this.notifyDataSetChanged();
            }
        }
    }

    public void addItemsFromBottom(List<YNStatus> items) {
        if (items == null)
            return;
        this.mDatas.addAll(mDatas.size(), items);
        this.notifyItemRangeInserted(mDatas.size(), items.size());
    }


    public int getIdByDirection(boolean isTop) {
        if (isTop) {
            if (mDatas.size() <= 0) {
                return 0;
            }
            return mDatas.get(0).getEid();
        } else {
            if (mDatas.size() <= 0) {
                return 0;
            }
            return mDatas.get(mDatas.size() - 1).getEid();
        }
    }

    private void popAwindow(View v, final YNStatus item) {
        final PopMenuTimeLine mPopMenu = new PopMenuTimeLine(context, UIHelper.dip2px(context, 230),
                UIHelper.dip2px(context, 100));
        mPopMenu.show(v);
        mPopMenu.getContentView().findViewById(R.id.timeline_face1).setOnClickListener(new MyZanOnClickListener("2", mPopMenu, item));
        mPopMenu.getContentView().findViewById(R.id.timeline_face2).setOnClickListener(new MyZanOnClickListener("4", mPopMenu, item));
        mPopMenu.getContentView().findViewById(R.id.timeline_face3).setOnClickListener(new MyZanOnClickListener("5", mPopMenu, item));
        mPopMenu.getContentView().findViewById(R.id.timeline_face4).setOnClickListener(new MyZanOnClickListener("3", mPopMenu, item));
        mPopMenu.getContentView().findViewById(R.id.timeline_face5).setOnClickListener(new MyZanOnClickListener("0", mPopMenu, item));
        mPopMenu.getContentView().findViewById(R.id.pop_timeline_synch).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                YNSingleton.getInstance().setCurStatus(item);
                context.startActivity(new Intent(context, TransferEventActivity.class).putExtra("type", 0));
                mPopMenu.dismiss();
            }
        });
        mPopMenu.getContentView().findViewById(R.id.pop_timeline_share).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.sendBroadcast(new Intent("doClickFristShare").putExtra("ynStatus", item));
                mPopMenu.dismiss();
            }
        });
        mPopMenu.getContentView().findViewById(R.id.pop_timeline_comment).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                YNSingleton.getInstance().setCurStatus(item);
                context.startActivity(new Intent(context, TimeKeyWordActivity.class));
//                        context.sendBroadcast(new Intent("TimeKeyWord"));
                mPopMenu.dismiss();
            }
        });
    }

    public class MyZanOnClickListener implements View.OnClickListener {
        String type;
        PopMenuTimeLine mPopMenu;
        YNStatus ynStatus;

        public MyZanOnClickListener(String type, PopMenuTimeLine mPopMenu, YNStatus ynStatus) {
            this.type = type;
            this.mPopMenu = mPopMenu;
            this.ynStatus = ynStatus;
        }

        @Override
        public void onClick(View v) {
            doClickZan(type, ynStatus);
            Intent doreintent = new Intent("doReward");
            doreintent.putExtra("userid", ynStatus.getPublishUser().getUserid());
            doreintent.putExtra("type", ynStatus.getLike().size());
            context.sendBroadcast(doreintent);
            mPopMenu.dismiss();
        }
    }

    private void doClickZan(final String type, final YNStatus ynStatus) {
        LinkedHashMap<String, String> mParam = new LinkedHashMap<>();
        mParam.put(CommonConstants.YNS_USER_ID, String.valueOf(userid));
        mParam.put(CommonConstants.YNS_EID, String.valueOf(ynStatus.getEid()));
        mParam.put(CommonConstants.YNS_TYPE, type);
        mParam.put(CommonConstants.YNS_SOURCE, "app");
        StringRequest req = new StringRequest(context.getResources().getString(R.string.BASE_URL) + "AttachOrRemoveExpression").setMethod(HttpMethods.Post).setParamMap(mParam)
                .setHttpListener(new HttpListener<String>(true, false, true) {
                    @Override
                    public void onSuccess(String s, Response<String> response) {
                        try {
                            JSONObject jsonObject = new JSONObject(s.toString());
                            if (jsonObject.optString("msg").equals("success") && jsonObject.optInt("code") == 0) {
                                for (int i = 0; i < mDatas.size(); i++) {
                                    if (mDatas.get(i).getEid() == ynStatus.getEid()) {
                                        List<YNLike> likes = mDatas.get(i).getLike();
                                        if (likes != null && likes.size() > 0) {
                                            List<YNLike> likesnew = new ArrayList<>();
                                            YNLike ynLike = new YNLike();
                                            ynLike.setUpic(MineFragement.avatarPic);
                                            ynLike.setLikeStatus(Integer.parseInt(type));
                                            ynLike.setLikeUserID(userid);
                                            likesnew.add(ynLike);
                                            for (int j = 0; j < likes.size(); j++) {
                                                if (likes.get(j).getLikeUserID() != userid)
                                                    likesnew.add(likes.get(j));
                                            }
                                            mDatas.get(i).getLike().clear();
                                            mDatas.get(i).setLike(likesnew);
                                        } else {
                                            YNLike ynLike = new YNLike();
                                            ynLike.setUpic(MineFragement.avatarPic);
                                            ynLike.setLikeStatus(Integer.parseInt(type));
                                            ynLike.setLikeUserID(userid);
                                            mDatas.get(i).getLike().add(ynLike);
                                        }
                                        TimeLineStatusFristAdapter.this.notifyDataSetChanged();
                                        Toast.makeText(context, "点赞成功", Toast.LENGTH_SHORT).show();
                                    }
                                }

                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }

                    @Override
                    public void onFailure(HttpException e, Response<String> response) {
//                        Toast.makeText(mContext, CommonConstants.YN_NET_LINK, Toast.LENGTH_SHORT).show();
                    }
                });
        LiteHttp.newApacheHttpClient(new HttpConfig(context)).executeAsync(req);
    }


    public class picOnClickListener implements View.OnClickListener {
        YNStatus ynStatus;
        int posttion;

        public picOnClickListener(YNStatus ynStatus, int posttion) {
            this.ynStatus = ynStatus;
            this.posttion = posttion;
        }

        @Override
        public void onClick(View v) {
            YNSingleton.getInstance().setCurStatus(ynStatus);
            Intent intent = new Intent(context, BrowseActivity.class);
            intent.putExtra(CommonConstants.YNPOSITION, posttion);
            intent.putExtra(CommonConstants.TIMELINE, true);
            context.startActivity(intent);
        }
    }
}
